473,418 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Image button acting like submit button.

I have a web page that i am using an image button as my submit button. The
code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as
the default button on the form?

Thanks in advance
Russell
Nov 18 '05 #1
3 5423
Russell,

I've had this problem before too and, to my knowledge at least, there is no
direct way to achieve this. Instead what I did was provide a handler for
the text box that handles the enter key. If the handler gets called, it
just forwards the processing to the image button's submit handler. This
solution isn't exactly the most elegant way, but it works.

Eric
"Russell" <la******@comcast.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
I have a web page that i am using an image button as my submit button. The
code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as
the default button on the form?

Thanks in advance
Russell

Nov 18 '05 #2
You can intercept the client side enter keypress event of the text box and
then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/20...200406so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Russell" <la******@comcast.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
I have a web page that i am using an image button as my submit button. The
code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as
the default button on the form?

Thanks in advance
Russell

Nov 18 '05 #3
It's very strange that in my project, they automatically act as a submit
button, so I have to add a (X,Y) = (0,0) checker in the click handler
routine just to skip when "enter" is pressed in the textbox.

Perheps there are more than one ImageButton in your form so the browser got
it mixed up.

"Eric Cherng" <ericch1@remove_the_dot-hotmai.l.com> ¦b¶l¥ó
news:%2***************@tk2msftngp13.phx.gbl ¤¤¼¶¼g...
Russell,

I've had this problem before too and, to my knowledge at least, there is no direct way to achieve this. Instead what I did was provide a handler for
the text box that handles the enter key. If the handler gets called, it
just forwards the processing to the image button's submit handler. This
solution isn't exactly the most elegant way, but it works.

Eric
"Russell" <la******@comcast.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
I have a web page that i am using an image button as my submit button. The code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as the default button on the form?

Thanks in advance
Russell


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicolas Keller | last post by:
Hi! I'm used to have Mozilla for testing my PHP sites when I'm coding. The site's nearly finished, now I've made a test with the Internet Exlporer... guess what... failed. The problem: I'm...
4
by: Ice Man | last post by:
Hi all How Can I submit a form by clicking on an image instead of the submit button? Thanks
6
by: Marek Mänd | last post by:
Can the <button><img></button> mutated via CSS so, that the inner image of <BUTTON> would entirely visually become the button itsself - I mean without the outer elements borders and so... ...
2
by: Matt | last post by:
In the following code, I have 2 questions regarding submit button with image. 1) Does this code <input type="image" name="populate" src="populate.gif"> behave the same as an HTML submit button...
1
by: Phil_Cam | last post by:
Hello All On a webpage I have a standard paypal image button for purchases. I am trying to set it up so that it only shows up or is endabled when text is entered into a textbox and a button is...
2
by: Bundy | last post by:
Hi On my webpages I have replaced the submit button with a rolling submit button using the script below (Script 1). This script is used by many of my webpages and is included in a external...
16
by: browntown | last post by:
so I have this application I'm nearly finished with. The only thing the client has requested is the ability to submit the form by pressing "enter". I didn't think this would be a huge pain in the...
2
by: Poppa Pimp | last post by:
ImageResizer.php Image Resizer PLEASE HELP The URL of the page this is on in my site is http://poppa-pimps-wallpapers.com//ImageResizer.php You can click on browse and get image,but...
2
by: Tim Streater | last post by:
The following test page is intended to allow the user to choose an image file, and then display it. It works as expected in Safari 3.1.1, FF 2.0.0.14 (Mac), and IE7 (XP). But, it fails in FF...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.